<template>
  <table-dialog title="导入错误信息"
    :pageInfo="errorPageInfo"
    :visible.sync="isDisplayErrorDialog"
    :data="importError.data"
    :columnConfigList="importError.column"></table-dialog>
</template>

<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator'

@Component
export default class ErrorTable extends Vue {
  reGetFn: Function = () => {}
  recordid: string = ''
  type: string = ''
  errorPageInfo: { pageSize: number; pageIndex: number; total: number } = {
    pageSize: 10,
    pageIndex: 1,
    total: 0
  }
  isDisplayErrorDialog: boolean = false
  importError = {
    data: [],
    column: [{ label: '错误原因', prop: 'errorMsg' }]
  }

  reFindList() {
    let { pageSize, pageIndex } = this.errorPageInfo
    this.reGetFn({
      pageSize,
      pageIndex,
      recordid: this.recordid,
      type: this.type
    }).then(({ total, dataList }: any) => {
      this.importError.data = dataList
      this.errorPageInfo.total = total
    })
  }

  @Watch('errorPageInfo.Index')
  changeDisplayErrorDialog() {
    this.reFindList()
  }
}
</script>